home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1992 June: ROMin Holiday / ADC Developer CD (1992-06) (''ROMin Holiday'')_iso / Developer Connection - 06-1992.iso / Periodicals / develop / develop 4 code / A⁄ROSE / ClientAppliƒ / ClientAppli.r < prev    next >
Encoding:
Text File  |  1990-07-01  |  5.5 KB  |  299 lines  |  [TEXT/MPS ]

  1. /*------------------------------------------------------------------------------
  2. #
  3. #    ClientAppli.r
  4. #
  5. #    derived from MPW 3.1's "Sample", a MultiFinder-Aware Simple Sample Application
  6. #
  7. #   Demostrates how to communicate with A/ROSE tasks 
  8. #
  9. #   Refer to the original source code in the MPW CExamples folder for more comments
  10. #
  11. #    Components:
  12. #                ClientAppli.c
  13. #                ClientAppli.r
  14. #                ClientAppli.h
  15. #                ClientAppli.make
  16. #
  17. ------------------------------------------------------------------------------*/
  18.  
  19.  
  20. #include "Types.r"
  21.  
  22. #include "ClientAppli.h"
  23.  
  24.  
  25.  
  26. resource 'MBAR' (rMenuBar, preload) {
  27.     { mApple, mFile, mEdit, mSleep};
  28. };
  29.  
  30.  
  31. resource 'MENU' (mApple, preload) {
  32.     mApple, textMenuProc,
  33.     AllItems & ~MenuItem2,    /* Disable dashed line, enable About and DAs */
  34.     enabled, apple,
  35.     {
  36.         "About ClientAppli…",
  37.             noicon, nokey, nomark, plain;
  38.         "-",
  39.             noicon, nokey, nomark, plain
  40.     }
  41. };
  42.  
  43. resource 'MENU' (mFile, preload) {
  44.     mFile, textMenuProc,
  45.     MenuItem12,                /* enable Quit only, program enables others */
  46.     enabled, "File",
  47.     {
  48.         "New",
  49.             noicon, "N", nomark, plain;
  50.         "Open",
  51.             noicon, "O", nomark, plain;
  52.         "-",
  53.             noicon, nokey, nomark, plain;
  54.         "Close",
  55.             noicon, "W", nomark, plain;
  56.         "Save",
  57.             noicon, "S", nomark, plain;
  58.         "Save As…",
  59.             noicon, nokey, nomark, plain;
  60.         "Revert",
  61.             noicon, nokey, nomark, plain;
  62.         "-",
  63.             noicon, nokey, nomark, plain;
  64.         "Page Setup…",
  65.             noicon, nokey, nomark, plain;
  66.         "Print…",
  67.             noicon, nokey, nomark, plain;
  68.         "-",
  69.             noicon, nokey, nomark, plain;
  70.         "Quit",
  71.             noicon, "Q", nomark, plain
  72.     }
  73. };
  74.  
  75. resource 'MENU' (mEdit, preload) {
  76.     mEdit, textMenuProc,
  77.     NoItems,                /* disable everything, program does the enabling */
  78.     enabled, "Edit",
  79.      {
  80.         "Undo",
  81.             noicon, "Z", nomark, plain;
  82.         "-",
  83.             noicon, nokey, nomark, plain;
  84.         "Cut",
  85.             noicon, "X", nomark, plain;
  86.         "Copy",
  87.             noicon, "C", nomark, plain;
  88.         "Paste",
  89.             noicon, "V", nomark, plain;
  90.         "Clear",
  91.             noicon, nokey, nomark, plain
  92.     }
  93. };
  94.  
  95. resource 'MENU' (mSleep, preload) {
  96.     mSleep, textMenuProc,
  97.     allEnabled,
  98.     enabled, "SleepTime",
  99.      {
  100.         "no Sleep",
  101.             noicon, nokey, nomark, plain;
  102.         "60 Ticks",
  103.             noicon, nokey, check, plain;
  104.     }
  105. };
  106.  
  107.  
  108. /* this ALRT and DITL are used as an About screen */
  109.  
  110. resource 'ALRT' (rAboutAlert, purgeable) {
  111.     {40, 20, 160, 320},
  112.     rAboutAlert,
  113.     { /* array: 4 elements */
  114.         /* [1] */
  115.         OK, visible, silent,
  116.         /* [2] */
  117.         OK, visible, silent,
  118.         /* [3] */
  119.         OK, visible, silent,
  120.         /* [4] */
  121.         OK, visible, silent
  122.     }
  123. };
  124.  
  125. resource 'DITL' (rAboutAlert, purgeable) {
  126.     { /* array DITLarray: 5 elements */
  127.         /* [1] */
  128.         {88, 200, 108, 290},
  129.         Button {
  130.             enabled,
  131.             "OK"
  132.         },
  133.         /* [2] */
  134.         {8, 8, 24, 290},
  135.         StaticText {
  136.             disabled,
  137.             "A/ROSE Task under MultiFinder"
  138.         },
  139.         /* [3] */
  140.         {32, 8, 48, 290},
  141.         StaticText {
  142.             disabled,
  143.             "(derived from MPW:CExamples:Sample)"
  144.         },
  145.         /* [4] */
  146.         {56, 8, 72, 136},
  147.         StaticText {
  148.             disabled,
  149.             "Brought to you by:"
  150.         },
  151.         /* [5] */
  152.         {80, 24, 112, 167},
  153.         StaticText {
  154.             disabled,
  155.             "Joseph Maurer (EURO.DTS)"
  156.         }
  157.     }
  158. };
  159.  
  160.  
  161. /* this ALRT and DITL are used as an error screen */
  162.  
  163. resource 'ALRT' (rUserAlert, purgeable) {
  164.     {40, 20, 160, 280},
  165.     rUserAlert,
  166.     { /* array: 4 elements */
  167.         /* [1] */
  168.         OK, visible, silent,
  169.         /* [2] */
  170.         OK, visible, silent,
  171.         /* [3] */
  172.         OK, visible, silent,
  173.         /* [4] */
  174.         OK, visible, silent
  175.     }
  176. };
  177.  
  178.  
  179. resource 'DITL' (rUserAlert, purgeable) {
  180.     { /* array DITLarray: 3 elements */
  181.         /* [1] */
  182.         {80, 150, 100, 230},
  183.         Button {
  184.             enabled,
  185.             "OK"
  186.         },
  187.         /* [2] */
  188.         {10, 60, 60, 230},
  189.         StaticText {
  190.             disabled,
  191.             "^0."
  192.         },
  193.         /* [3] */
  194.         {8, 8, 40, 40},
  195.         Icon {
  196.             disabled,
  197.             2
  198.         }
  199.     }
  200. };
  201.  
  202. resource 'STR ' (rTaskName, purgeable) {
  203.  "myTaskName"
  204. };
  205.  
  206. resource 'STR ' (rTaskType, purgeable) {
  207.  "myTaskType"
  208. };
  209.  
  210. resource 'STR ' (rClientName, purgeable) {
  211.  "ClientApp"
  212. };
  213.  
  214. resource 'STR ' (rClientType, purgeable) {
  215.  "ClientType"
  216. };
  217.  
  218.  
  219. resource 'STR#' (rErrStrings, purgeable) {
  220.     {
  221.     "You must run on 512Ke or later";
  222.     "Application Memory Size is too small";
  223.     "Not enough memory to run TaskSample";
  224.     "Cannot create window";
  225.     "Cannot use A/ROSE Prep";
  226.     "Task already registered";
  227.     "<GetMsg> failed";
  228.     "No Server task found";
  229.     "Problem with ICC Manager";
  230.     "Received message with unknown mCode";
  231.     "Received undeliverable message";
  232.     }
  233. };
  234.  
  235. resource 'STR#' (rWndStrings, purgeable) {
  236.     {
  237.     "OpenQueue returned: $";
  238.     "(this is my TID !)";
  239.     " Messages received: ";
  240.     " ............ sent: ";
  241.     "         ServerTID: $";
  242.     }
  243. };
  244.  
  245.  
  246. resource 'WIND' (rWindow, preload, purgeable) {
  247.     {40, 10, 220, 250},
  248.     noGrowDocProc, visible, noGoAway, 0x0, "ClientAppli"
  249. };
  250.  
  251.  
  252. resource 'CNTL' (rResetBtn, "BtnRESET") {
  253.     {150, 20, 170, 70},
  254.     0,
  255.     visible,
  256.     0,
  257.     0,
  258.     pushButProc,
  259.     0,
  260.     "Reset"
  261. };
  262.  
  263. resource 'CNTL' (rSendBtn, "BtnSEND") {
  264.     {150, 170, 170, 220},
  265.     0,
  266.     visible,
  267.     0,
  268.     0,
  269.     pushButProc,
  270.     0,
  271.     "Send"
  272. };
  273.  
  274.  
  275.  
  276. /* here is the quintessential MultiFinder friendliness device, the SIZE resource */
  277.  
  278. resource 'SIZE' (-1) {
  279.     dontSaveScreen,
  280.     acceptSuspendResumeEvents,
  281.     enableOptionSwitch,
  282.     canBackground,                /* we can background; we don't currently, but our sleep value */
  283.                                 /* guarantees we don't hog the Mac while we are in the background */
  284.     multiFinderAware,            /* this says we do our own activate/deactivate; don't fake us out */
  285.     backgroundAndForeground,    /* this is definitely not a background-only application! */
  286.     dontGetFrontClicks,            /* change this is if you want "do first click" behavior like the Finder */
  287.     ignoreChildDiedEvents,        /* essentially, I'm not a debugger (sub-launching) */
  288.     not32BitCompatible,            /* this app should not be run in 32-bit address space */
  289.     reserved,
  290.     reserved,
  291.     reserved,
  292.     reserved,
  293.     reserved,
  294.     reserved,
  295.     reserved,
  296.     kPrefSize * 1024,
  297.     kMinSize * 1024    
  298. };
  299.